<template>  
  <el-row>
    <el-col :span="24">
      <div class="box">
        <div class="box-header">
          <el-col :span="6">
            <h3 class="box-title" style="line-height: 40px;">
              我的项目
            </h3>
          </el-col>
   		</div>
        <div class="box-body">
          <el-table
            :data="tableData"
            style="width: 100%">
            <el-table-column
              prop="id"
              label="ID"
              width="180">
            </el-table-column>
            <el-table-column
              prop="project_id"
              label="项目编号"
              :formatter="showSch"
              width="180">
            </el-table-column>
            <el-table-column
              prop="year"
              label="项目年份">
            </el-table-column>
            <el-table-column
              prop="title"
              label="项目名称">
            </el-table-column>
            <el-table-column
              prop="status"
              label="状态"
              width="150">
               <template scope="scope">
                <el-tag
                  :type="statusList[scope.row.status]['type1']"
                  close-transition
                  >{{ statusList[scope.row.status]['msg1'] }}</el-tag
                >
              </template>
            </el-table-column>
            </el-table>
             <el-pagination
              @current-change="handleCurrentChange"
              :current-page="currentPage"
              layout="prev, pager, next"
              :page-count="total"
              style="float: right;"
            ></el-pagination>
          </div>
        </div>
      </el-col> 
    </div>
  </div>
</el-row>
</template>

<script>
import common from './../../../assets/js/common'
import http from './../../../assets/js/http'
export default {
  data() {
    return {
      userInfo: Lockr.get('userInfo'),
      statusList: common.statusList,
      tableData: [], //其他信息
      currentPage: 1,
      total: 1
    }
  },
  methods: { 
    getList(){
    	let data = {
    		idnumber:this.userInfo.username
    	}
    	console.log(data)
      this.apiPost('admin/Report/Mysubproject', data).then(res => {
        this.handelResponse(res, data => {
          console.log(res.data)
          this.total = Math.ceil(data.total / data.per_page)
          this.tableData = res.data.data
          console.log(this.tableData)
         })
    })
  },
  handleCurrentChange(currentPage) {
      this.currentPage = currentPage
      let data = {
        page: this.currentPage
      }
      this.getList(data)
    }
  },

  created() {
    this.getList()
    _g.closeGlobalLoading()
  },
  mixins: [http]
}
</script>
<style scoped>
.box {
  position: relative;
  border-radius: 3px;
  background: #fff;
  border-top: 3px solid #d2d6de;
  margin-bottom: 20px;
  width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  border-top-color: #3c8dbc;
}
.box-body {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  padding: 10px;
  min-height: 0.01%;
  overflow-x: auto;
}
.box-header {
  height: 34px;
  line-height: 34px;
  color: #444;
  display: block;
  padding: 10px;
  position: relative;
}</style>